[Draft] Propagate cancellation to model and EP downloads#674
Open
[Draft] Propagate cancellation to model and EP downloads#674
Conversation
Agent-Logs-Url: https://github.com/microsoft/Foundry-Local/sessions/21906197-0d60-44b4-b5e6-4698c0fecfe3 Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>
…ovided Agent-Logs-Url: https://github.com/microsoft/Foundry-Local/sessions/21906197-0d60-44b4-b5e6-4698c0fecfe3 Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds download cancellation support across SDKs by routing model and EP downloads through streaming/callback interop when a cancellation signal/token/flag is supplied, and documenting the new behavior.
Changes:
- Rust: add cancellable variants of model/EP download APIs and cancellable streaming interop in
CoreInterop. - Python/JS/C#: add cancellation parameters (Event/AbortSignal/CancellationToken) and ensure downloads use callback/streaming paths to observe cancellation.
- Docs/tests: document cancellation usage and add unit tests verifying the callback/streaming path is used when cancellation is provided.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/rust/src/foundry_local_manager.rs | Adds cancellable EP download APIs and routes to cancellable streaming interop. |
| sdk/rust/src/detail/model_variant.rs | Adds cancellable model variant download path via cancellable streaming interop. |
| sdk/rust/src/detail/model.rs | Exposes cancellable model download API. |
| sdk/rust/src/detail/core_interop.rs | Adds cancellable streaming interop and cancellation checks in the FFI callback trampoline. |
| sdk/rust/README.md | Documents Rust cancellation usage for downloads. |
| sdk/python/test/test_model.py | Adds a test ensuring model download uses callback path when cancel_event is provided. |
| sdk/python/test/test_foundry_local_manager.py | Adds a test ensuring EP download uses callback path when cancel_event is provided. |
| sdk/python/src/imodel.py | Extends download() interface with optional cancel_event. |
| sdk/python/src/foundry_local_manager.py | Adds cancel_event support and routes through callback interop when provided. |
| sdk/python/src/detail/model_variant.py | Adds cancel_event support and routes through callback interop when provided. |
| sdk/python/src/detail/model.py | Plumbs cancel_event through Model.download() to the selected variant. |
| sdk/python/src/detail/core_interop.py | Adds cancellation support to callback helper and raises on cancellation. |
| sdk/python/README.md | Documents Python cancellation usage for downloads. |
| sdk/js/test/model.test.ts | Adds a test ensuring model download uses streaming interop when only AbortSignal is provided. |
| sdk/js/test/foundryLocalManager.test.ts | Adds a test ensuring EP download passes AbortSignal through to streaming interop. |
| sdk/js/src/imodel.ts | Extends download() interface with optional AbortSignal. |
| sdk/js/src/foundryLocalManager.ts | Adds AbortSignal overloads and passes signal to streaming interop. |
| sdk/js/src/detail/modelVariant.ts | Routes model download to streaming when progress or cancellation is needed. |
| sdk/js/src/detail/model.ts | Plumbs AbortSignal through Model.download() to the selected variant. |
| sdk/js/src/detail/coreInterop.ts | Adds AbortSignal-aware streaming wrapper that rejects with AbortError on cancellation. |
| sdk/js/README.md | Documents JS cancellation usage for downloads. |
| sdk/cs/test/FoundryLocal.Tests/Utils.cs | Improves repo-root discovery to handle .git files (worktrees/submodules). |
| sdk/cs/test/FoundryLocal.Tests/DownloadCancellationTests.cs | Adds a test covering cancellation propagation via callback path in model download. |
| sdk/cs/src/FoundryLocalManager.cs | Routes EP download through callback path when cancellation is possible; checks token in callback. |
| sdk/cs/src/Detail/ModelVariant.cs | Routes model download through callback path when cancellation is possible; checks token in callback. |
| sdk/cs/src/Detail/CoreInterop.cs | Preserves OperationCanceledException propagation from callback execution. |
| sdk/cs/README.md | Documents C# cancellation usage for downloads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.